package com.webrtc.ns;

/**
 * Created by kratos.
 * Copyright © 2020年 All rights reserved.
 */
public class WebRTCNoiseSuppression {

    // https://blog.csdn.net/gobitan/article/details/8847530 byte[] short[] 互转参考
    public static short[] byteArray2ShortArray(byte[] data, int items) {
        short[] retVal =new short[items];
        for (int i =0; i < retVal.length; i++){
            retVal[i] = (short) ((data[i *2]&0xff) | (data[i *2+1]&0xff) <<8);
        }
        return retVal;
    }

    // wav file
    public native static void process(String inputFile, String outputFile, int level);

    // pcm
    public native static short[] processpcm(short[] Input, int sampleRate, int inSampleCount, int level);

    static {
        System.loadLibrary("webrtc_ns");
    }
}
